library bmfmap_base.map.bmf_map_sdk;

import 'package:flutter/services.dart';
import 'bmf_types.dart';

/// 鉴权方法名
const kSetAPIKey = 'flutter_bmfbase/sdk/setApiKey';

/// 地图sdk初始化鉴权
class BMFMapSDK {
  /// 鉴权通信
  static const MethodChannel _channel = const MethodChannel('flutter_bmfbase');

  /// 初始化百度地图sdk
  ///
  /// apiKey 百度地图开放平台申请的ak
  /// coordType 坐标类型
  static void setApiKeyAndCoordType(
      String apiKey, BMF_COORD_TYPE coordType) async {
    // baidu.map/setApiKey方法名
    await _channel.invokeMethod(
        kSetAPIKey, {'apiKey': apiKey, 'BMF_COORD_TYPE': coordType.index});
  }

  /// 设置地图坐标类型
  ///
  /// coordType 坐标类型
  static void setCoordType(BMF_COORD_TYPE coordType) async {
    await _channel
        .invokeMethod(kSetAPIKey, {'BMF_COORD_TYPE': coordType.index});
  }
}
